{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1d640adc",
   "metadata": {},
   "source": [
    "请使用K-Means对客户进行分群\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44cf83b3",
   "metadata": {},
   "source": [
    "字段介绍：\n",
    "\n",
    "FRESH：新鲜商品年度支出MILK：牛奶商品年度支出\n",
    "\n",
    "GROCERY:杂货商品年度支出\n",
    "\n",
    "FROZEN:冷冻品年度支出\n",
    "\n",
    "DETERGENTS_PAPER: 清洁剂和纸制品的年度支出（百万美元）\n",
    "\n",
    "DELICATESSEN: 熟食产品年度支出（百万美元）\n",
    "\n",
    "CHANNEL: 销售渠道，horeca（酒店/餐厅/咖啡厅）或Retail（零售渠道8) ；horeca取1，Retail取2\n",
    "\n",
    "REGION:销售地区，Lison, Oporto or Other；Lison取1，Oporto取2，Other取3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d503dc14",
   "metadata": {},
   "source": [
    "### 查看数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e9c44e7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "08a99421",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>12669</td>\n",
       "      <td>9656</td>\n",
       "      <td>7561</td>\n",
       "      <td>214</td>\n",
       "      <td>2674</td>\n",
       "      <td>1338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>7057</td>\n",
       "      <td>9810</td>\n",
       "      <td>9568</td>\n",
       "      <td>1762</td>\n",
       "      <td>3293</td>\n",
       "      <td>1776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>6353</td>\n",
       "      <td>8808</td>\n",
       "      <td>7684</td>\n",
       "      <td>2405</td>\n",
       "      <td>3516</td>\n",
       "      <td>7844</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>13265</td>\n",
       "      <td>1196</td>\n",
       "      <td>4221</td>\n",
       "      <td>6404</td>\n",
       "      <td>507</td>\n",
       "      <td>1788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>22615</td>\n",
       "      <td>5410</td>\n",
       "      <td>7198</td>\n",
       "      <td>3915</td>\n",
       "      <td>1777</td>\n",
       "      <td>5185</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Channel  Region  Fresh  Milk  Grocery  Frozen  Detergents_Paper  Delicassen\n",
       "0        2       3  12669  9656     7561     214              2674        1338\n",
       "1        2       3   7057  9810     9568    1762              3293        1776\n",
       "2        2       3   6353  8808     7684    2405              3516        7844\n",
       "3        1       3  13265  1196     4221    6404               507        1788\n",
       "4        2       3  22615  5410     7198    3915              1777        5185"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('../data/Wholesale customers data.csv')\n",
    "df.head()    #(440,8)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1fc892f8",
   "metadata": {},
   "source": [
    "### 查看数据缺失值---数据并没有缺失值，数据完整性比较好\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8fa0673d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 440 entries, 0 to 439\n",
      "Data columns (total 8 columns):\n",
      " #   Column            Non-Null Count  Dtype\n",
      "---  ------            --------------  -----\n",
      " 0   Channel           440 non-null    int64\n",
      " 1   Region            440 non-null    int64\n",
      " 2   Fresh             440 non-null    int64\n",
      " 3   Milk              440 non-null    int64\n",
      " 4   Grocery           440 non-null    int64\n",
      " 5   Frozen            440 non-null    int64\n",
      " 6   Detergents_Paper  440 non-null    int64\n",
      " 7   Delicassen        440 non-null    int64\n",
      "dtypes: int64(8)\n",
      "memory usage: 27.6 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "5a8fca31",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.322727</td>\n",
       "      <td>2.543182</td>\n",
       "      <td>12000.297727</td>\n",
       "      <td>5796.265909</td>\n",
       "      <td>7951.277273</td>\n",
       "      <td>3071.931818</td>\n",
       "      <td>2881.493182</td>\n",
       "      <td>1524.870455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.468052</td>\n",
       "      <td>0.774272</td>\n",
       "      <td>12647.328865</td>\n",
       "      <td>7380.377175</td>\n",
       "      <td>9503.162829</td>\n",
       "      <td>4854.673333</td>\n",
       "      <td>4767.854448</td>\n",
       "      <td>2820.105937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>55.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3127.750000</td>\n",
       "      <td>1533.000000</td>\n",
       "      <td>2153.000000</td>\n",
       "      <td>742.250000</td>\n",
       "      <td>256.750000</td>\n",
       "      <td>408.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>8504.000000</td>\n",
       "      <td>3627.000000</td>\n",
       "      <td>4755.500000</td>\n",
       "      <td>1526.000000</td>\n",
       "      <td>816.500000</td>\n",
       "      <td>965.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>16933.750000</td>\n",
       "      <td>7190.250000</td>\n",
       "      <td>10655.750000</td>\n",
       "      <td>3554.250000</td>\n",
       "      <td>3922.000000</td>\n",
       "      <td>1820.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>112151.000000</td>\n",
       "      <td>73498.000000</td>\n",
       "      <td>92780.000000</td>\n",
       "      <td>60869.000000</td>\n",
       "      <td>40827.000000</td>\n",
       "      <td>47943.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          Channel      Region          Fresh          Milk       Grocery  \\\n",
       "count  440.000000  440.000000     440.000000    440.000000    440.000000   \n",
       "mean     1.322727    2.543182   12000.297727   5796.265909   7951.277273   \n",
       "std      0.468052    0.774272   12647.328865   7380.377175   9503.162829   \n",
       "min      1.000000    1.000000       3.000000     55.000000      3.000000   \n",
       "25%      1.000000    2.000000    3127.750000   1533.000000   2153.000000   \n",
       "50%      1.000000    3.000000    8504.000000   3627.000000   4755.500000   \n",
       "75%      2.000000    3.000000   16933.750000   7190.250000  10655.750000   \n",
       "max      2.000000    3.000000  112151.000000  73498.000000  92780.000000   \n",
       "\n",
       "             Frozen  Detergents_Paper    Delicassen  \n",
       "count    440.000000        440.000000    440.000000  \n",
       "mean    3071.931818       2881.493182   1524.870455  \n",
       "std     4854.673333       4767.854448   2820.105937  \n",
       "min       25.000000          3.000000      3.000000  \n",
       "25%      742.250000        256.750000    408.250000  \n",
       "50%     1526.000000        816.500000    965.500000  \n",
       "75%     3554.250000       3922.000000   1820.250000  \n",
       "max    60869.000000      40827.000000  47943.000000  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7b9c1d62",
   "metadata": {},
   "source": [
    "### 在此使用Normalizer---使用方法同MinMaxScaler、StandardScaler\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "16ccf95c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import Normalizer "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9c4aac75",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(440, 8)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m,n = df.shape\n",
    "m,n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "657ea34e",
   "metadata": {},
   "outputs": [],
   "source": [
    "X = df.iloc[:,2:n]\n",
    "\n",
    "normalizer =Normalizer().fit(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "664ff8fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.70833271, 0.53987376, 0.42274083, 0.01196489, 0.14950522,\n",
       "        0.07480852],\n",
       "       [0.44219826, 0.61470384, 0.59953989, 0.11040858, 0.20634248,\n",
       "        0.11128583],\n",
       "       [0.39655169, 0.5497918 , 0.47963217, 0.15011913, 0.2194673 ,\n",
       "        0.48961931],\n",
       "       ...,\n",
       "       [0.36446153, 0.38846468, 0.7585445 , 0.01096068, 0.37223685,\n",
       "        0.04682745],\n",
       "       [0.93773743, 0.1805304 , 0.20340427, 0.09459392, 0.01531   ,\n",
       "        0.19365326],\n",
       "       [0.67229603, 0.40960124, 0.60547651, 0.01567967, 0.11506466,\n",
       "        0.01254374]])"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Xnorm = normalizer.transform(X)\n",
    "Xnorm"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "151fd94e",
   "metadata": {},
   "source": [
    "### 使用轮廓系数找到最优K"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "88568532",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "from sklearn.metrics import silhouette_score\n",
    "from sklearn.metrics import silhouette_samples"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "f156b8a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "1299a5dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1c8306d1ac8>]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAkcElEQVR4nO3de3xU9Z3/8ddnJgkkIVwTCAIaEBBCAMWAuKXWVVFwW6hFLWpVRKW2ovayv9Z2u7bV3my72htt1xVUtII+XN2lCnhZtRdbgaAIJIAGxAImEO53Qsjn98dMcIiBDORyJjPv5+ORB3PO+Z6ZT47Oe07O5TPm7oiISPIKBV2AiIi0LAW9iEiSU9CLiCQ5Bb2ISJJT0IuIJLm0oAuoLzc31wsKCoIuQ0SkTVm6dOlWd89raFnCBX1BQQElJSVBlyEi0qaY2QfHW6ZDNyIiSU5BLyKS5BT0IiJJTkEvIpLkFPQiIkkurqA3s3FmtsbMys3s7gaWTzGzKjNbFv25JWbZ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LMJ4DrgRXR47sA3wZOB3D33xPpy3M5UA7sB25KkLquBL5kZjXAAWBySwcEkauBHrPIV0KGgKfd/Xk7tindTOBxMysHthMJkpYWT113mtkEoCZa15RWqKtBCbC94qkrqO3VA3gumpdpRL5adKGZ3QaBvifjqSuI9yTAHcAfzCwDWAfc1JLbSy0QRESSXJs7dCMiIidHQS8ikuQU9CIiSU5BLyKS5BT0IiJJTkEvIpLkFPQiIknu/wPKGpRm5UqAVQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "score = []\n",
    "for i in range(2,7):\n",
    "    cluster  = KMeans(n_clusters=i,random_state=42).fit(Xnorm)\n",
    "    score.append(silhouette_score(Xnorm,cluster.labels_))\n",
    "plt.plot(range(2,7),score)\n",
    "# plt.axvline(pd.DataFrame(score).idxmax()[0]+2,ls=':')   "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f40b4b8e",
   "metadata": {},
   "source": [
    "### 建模及可视化分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "16787d69",
   "metadata": {},
   "outputs": [],
   "source": [
    "#建模分3类\n",
    "cluster  = KMeans(n_clusters=3,random_state=42).fit(Xnorm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "d85a4579",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 2,\n",
       "       0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 2, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1,\n",
       "       1, 0, 2, 0, 2, 1, 2, 0, 1, 0, 2, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0,\n",
       "       2, 0, 0, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,\n",
       "       0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 0,\n",
       "       0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 1, 0, 1,\n",
       "       0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,\n",
       "       0, 0, 0, 2, 0, 0, 1, 2, 1, 0, 2, 1, 1, 1, 0, 0, 0, 1, 0, 0, 2, 1,\n",
       "       0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0,\n",
       "       0, 1, 2, 2, 0, 0, 0, 2, 1, 2, 2, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,\n",
       "       0, 0, 1, 1, 0, 0, 0, 2, 2, 1, 2, 0, 1, 0, 0, 2, 0, 0, 0, 2, 0, 1,\n",
       "       1, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "       0, 0, 0, 0, 1, 0, 2, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0,\n",
       "       0, 1, 2, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 2, 2, 1, 0, 2,\n",
       "       0, 1, 0, 1, 2, 0, 0, 2, 2, 2, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 2, 1,\n",
       "       1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "       0, 0, 1, 0, 0, 1, 0, 0, 0, 2, 1, 0, 1, 0, 0, 0, 2, 1, 1, 0, 0, 0,\n",
       "       1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1,\n",
       "       1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "cluster.labels_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "11dc0da3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>12669</td>\n",
       "      <td>9656</td>\n",
       "      <td>7561</td>\n",
       "      <td>214</td>\n",
       "      <td>2674</td>\n",
       "      <td>1338</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>7057</td>\n",
       "      <td>9810</td>\n",
       "      <td>9568</td>\n",
       "      <td>1762</td>\n",
       "      <td>3293</td>\n",
       "      <td>1776</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>6353</td>\n",
       "      <td>8808</td>\n",
       "      <td>7684</td>\n",
       "      <td>2405</td>\n",
       "      <td>3516</td>\n",
       "      <td>7844</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>13265</td>\n",
       "      <td>1196</td>\n",
       "      <td>4221</td>\n",
       "      <td>6404</td>\n",
       "      <td>507</td>\n",
       "      <td>1788</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>22615</td>\n",
       "      <td>5410</td>\n",
       "      <td>7198</td>\n",
       "      <td>3915</td>\n",
       "      <td>1777</td>\n",
       "      <td>5185</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Channel  Region  Fresh  Milk  Grocery  Frozen  Detergents_Paper  \\\n",
       "0        2       3  12669  9656     7561     214              2674   \n",
       "1        2       3   7057  9810     9568    1762              3293   \n",
       "2        2       3   6353  8808     7684    2405              3516   \n",
       "3        1       3  13265  1196     4221    6404               507   \n",
       "4        2       3  22615  5410     7198    3915              1777   \n",
       "\n",
       "   Delicassen  label  \n",
       "0        1338      0  \n",
       "1        1776      1  \n",
       "2        7844      1  \n",
       "3        1788      0  \n",
       "4        5185      0  "
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['label']=cluster.labels_\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "a3867eab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    214\n",
       "1    173\n",
       "2     53\n",
       "Name: label, dtype: int64"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#画饼图\n",
    "p1 = df.label.value_counts()\n",
    "p1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "af33e789",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64Index([0, 1, 2], dtype='int64')"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p1.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "cb364d32",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "8dfe8d92",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1c8339567b8>"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOoAAADnCAYAAAAQCsqQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAveElEQVR4nO2dd3gc1dX/P3dmu3qXbMteY8vCxsYVFFOdYKqDDISSEIhJKCHwQkjehCj8khe9IXkxaSSQEBIIJIRQQguCJfTejI0NyGDkKmzZVpd21bbNzO+PWRcZW5Ll1c6udD/Ps89KszN3zq703XPLOecKwzCQSCTJjWK1ARKJZHCkUCWSFEAKVSJJAaRQJZIUQApVIkkBpFAlkhRAClUiSQGkUCWSFEAKVSJJAaRQJZIUwGa1ARJJPHj//fcLbTbb3cBMktMB6cDaaDR62fz585sP9mIp1DGEEMID/BT4GlACbAPuBX5pGEbEStsOFZvNdndxcfH0goKCDkVRki6AXdd10dLSMqOxsfFuoPJgr0/Gbx7JC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FsAVYAdUCDHHsmFinUITBcoe5NZbndhrknyjTgaMxi4QZm9zEMdAM9sWOkO7CV5SrZ4zOVrKI0kZnnEVk5LpGZ6RRZ6Q6RYVOw2xTsqvlsU0T/5HdNN/SoTlgziEQ0IlHdCPdE6PEHDX97n9HZ0mv4d3bp/q1+w7+5Q++N6KRhbroFpjADwPvAR8CmsVj+JJmQQh0C8RDqvlSW292YG1yVAFMwBbz30o6CuQQUij2CxLrO+8OuoKQ7sKmKUAIhIxzW2HvLQQE4McMiXYCD2BdC7LU+TI9Zh1m1sQHolF3a5EEKdQiMhFD3R6yAeBHmNgxZQCHm/ikFQD7ght0CHOwPJ/Z6NoB2zGWkJsyQyA7Ajxm84ZeiTG6kUIdATKhvG4ZxrJV2xOoVOzHHjfa9nu2YM82RvR7hvX4OxfbokaQoUqhDICbUDw3DmGO1LZKxiay+NzQMzJ2sJRJLkEIdGhuBgBCi0GpDJGMT2fWVSFIA6VElkhRAClUiSQGkUCWSFEAKVSJJAaRQJZIUQApVIkkBpFAlkhRAClUiSQGkUCWSFEAKVSJJAaRQJZIUQApVIkkBpFAlkhRAClUiSQGkUCWSFEAKVSJJAaRQJZIUQApVIkkBpFAlkhRAClUiSQGkUCWSFEAKVSJJAf4/xpOBvB2CEU4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "matplotlib.rcParams['font.sans-serif']='STXinwei'\n",
    "\n",
    "_ = plt.pie(p1,\n",
    "            labels= p1.index,\n",
    "            textprops={'fontsize':18}, # 设置字体样式\n",
    "            autopct='%0.0f%%', # 显示百分比\n",
    "            explode = [0,0,0.15],# 突出某一部分\n",
    "            shadow=True)\n",
    "plt.legend()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "fb25f4ea",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\anaconda3\\envs\\tensorflow_env\\lib\\site-packages\\ipykernel_launcher.py:14: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.\n",
      "  \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>label</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.764226</td>\n",
       "      <td>0.273881</td>\n",
       "      <td>0.253752</td>\n",
       "      <td>0.458751</td>\n",
       "      <td>0.148727</td>\n",
       "      <td>0.431020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.159238</td>\n",
       "      <td>0.658006</td>\n",
       "      <td>0.697036</td>\n",
       "      <td>0.187926</td>\n",
       "      <td>0.829117</td>\n",
       "      <td>0.410534</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.076536</td>\n",
       "      <td>0.068114</td>\n",
       "      <td>0.049212</td>\n",
       "      <td>0.353323</td>\n",
       "      <td>0.022156</td>\n",
       "      <td>0.158446</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          Fresh      Milk   Grocery    Frozen  Detergents_Paper  Delicassen\n",
       "label                                                                      \n",
       "0      0.764226  0.273881  0.253752  0.458751          0.148727    0.431020\n",
       "1      0.159238  0.658006  0.697036  0.187926          0.829117    0.410534\n",
       "2      0.076536  0.068114  0.049212  0.353323          0.022156    0.158446"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "\n",
    "#每一个类别中fresh的平均值\n",
    "# df.groupby(by ='label')['Fresh','Milk','Grocery','Frozen','Detergents_Paper','Delicassen'].mean().round(1)\n",
    "gresult = df.groupby(by ='label')['Fresh','Milk','Grocery','Frozen','Detergents_Paper','Delicassen'].sum()/df[['Fresh','Milk','Grocery','Frozen','Detergents_Paper','Delicassen']].sum()\n",
    "gresult"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "5b55d1c6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Fresh               5280131\n",
       "Milk                2550357\n",
       "Grocery             3498562\n",
       "Frozen              1351650\n",
       "Detergents_Paper    1267857\n",
       "Delicassen           670943\n",
       "dtype: int64"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['Fresh','Milk','Grocery','Frozen','Detergents_Paper','Delicassen']].sum()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "f44c7724",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64Index([0, 1, 2], dtype='int64', name='label')"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gresult.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "a9bf8a06",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "label\n",
       "0    0.764226\n",
       "1    0.159238\n",
       "2    0.076536\n",
       "Name: Fresh, dtype: float64"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gresult['Fresh']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "5d916fe2",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([<matplotlib.axis.XTick at 0x1c834e67b00>,\n",
       "  <matplotlib.axis.XTick at 0x1c834e676d8>,\n",
       "  <matplotlib.axis.XTick at 0x1c834e67358>],\n",
       " [Text(0, 0, '0'), Text(1, 0, '1'), Text(2, 0, '2')])"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhoAAAFkCAYAAABmeZIKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAixklEQVR4nO3de5SXZb338fd3hvNRobEkUItKgVAeHQ8RbMBI2mCpoVtMtoEZUIqSh62pKJL7wbXI84P1GG5PoblZ5E4lT8BQNIU7Mk+puR8NDTMdQTkoA8x4PX84TMM4OD9lrjng+7UWi7nv+/rdv+/NrFnz4brv3/WNlBKSJEk5FLV0AZIkafdl0JAkSdkYNCRJUjYGDUmSlI1BQ5IkZWPQkCRJ2bRriTf92Mc+lvbbb7+WeGtJktTE/vCHP7yeUipp6FiLBI399tuPVatWtcRbS5KkJhYRL+7smLdOJElSNgYNSZKUjUFDkiRl0yLPaDRk27ZtrFmzhsrKypYuRR9Qp06d6Nu3L+3bt2/pUiRJrUyrCRpr1qyhe/fu7LfffkRES5ejAqWUWLt2LWvWrOFTn/pUS5cjSWplWs2tk8rKSnr37m3IaGMigt69ezsTJUlqUKsJGoAho43y+yZJ2plWc+ukvv0uWNyk51t9xbhGx2zYsIG99tqLI444g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x//vl88Ytf5Nxzz+Xuu+/ml7/8ZfNcrCRJzeQjc+ukMaeddhoLFixg2bJ/9Fzo2bMnJSUlVFVVsW3bNgAOPPBA7r333toxixYt4sgjj+STn/wk5eXlAFRXVzNw4ED69+/PQw89xPLly5kxYwYAmzdvrn1t586dOe6445gyZQojR46kc+fOzXClkiQ1H4NGjf79+/OrX/2K//iP/2DEiBEMHz6ck046ie9973vssccevPDCCwB861vforq6mqFDhzJy5Eg+/elPc+yxxzJ9+nSee+45hg0bxsiRI/nsZz/LMcccwz/90z8xdOhQbrrpJgCqqqpqO78CTJ06lYULFzJt2rQWuW5JknLa7bq3NvSgZ0MO7LvHLr9XUygvL+e6667jrrvuaulSdondW7Ur7N4qtW12b23FrrzySs4999yWLkOSpCx8GLSF/fznP2/pEiRJysYZDUmSlI1BQ5IkZWPQkCRJ2Rg0JElSNq32YdBnDvhwH5XcWSu0bUt+1+hrN2zYwF577cURRxxBZWUlgwYNql3/QpIkfXCtNmi0hO7du/OJT3yito/Jh7Ft2zY7v0qSVMNbJ3Vs71OyXd1uq6eccgpbt25l+vTptR1Z58yZA8Cll17K0KFDOfjggznggAMAuPfee2vH3XzzzaSUOPDAAzn11FMZOnQokyZNau7LkySp2TmjUc+rr77KyJEjSSkxderUHbqtzp07l3333Zfrr7+e6upqjj/+eB566CEuu+wyLrvsMk444QROO+001q9fzw9/+EOWLl0KwP7778/kyZN5++23uf766+natSvDhw/n6aefZuDAgS18xZIk5WPQqKdfv3473Dq59NJLa7ut/u53v+O6664DoLi4mKOPPpqnnnqKo446ivnz57PPPvswZswYfv/73/PCCy/wla98herqar72ta8B0K5dO7p27QrAgAEDeP3115v34iRJamYGjXo2bdq0w3bdbqvbO7eeddZZVFVVce+99zJz5kz+/Oc/c+utt9bOYPTv35+9996b++67j06dOrF161aA2g6wAEVFRVRVVTXDFUmS1HIMGvVEBJWVlXTq1An4R7fV7t27c+GFFzJt2jSGDx9OUVERU6ZM4ZBDDmHMmDFUVFTwpS99iU6dO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f/5pt27Zxxx138PTTT/PXv/6V8847jx49ehTcTv6SSy7hjjvuYMmSJQBcc801PP744xQXF7+nZni3adtNN93EQw89xODBg7nhhhsoKipi7ty5HHjggZxxxhk8+uij9OrVi549e7JgwQKqq6s57rjjWLZsGWVlZRx77LGMHz+eq666ittuu40ePXqwevVqysrKqK6uzvRdkCTtTgwajXj22Wfp0qVLg23f63r00Ue56KKL2LZtG+3ateOcc87hj3/8I4ceeigdOnSgQ4cOjBs3js985jP069ePyy+/nOeee+5Dt5M/66yzOPnkk1mwYMFOw8bkyZO56KKLarfXr1/P1VdfzUsvvcSLL77I8ccfT7t27ejevTvw7u2ZMWPG8Mwzz/Doo4+yYsUK5s2bR0Qwd+5cnnjiCUpLSykqKqKoyDXZJEmNM2i8j9WrV3POOedQVlbGGWec8Z6278XFxbVt5AcNGsT06dMZNmwYW7durb1tUb/N/Lp167j44ov57Gc/y7p16z5QO/ktW7bU7v/2t7/NypUr+e1vf9vgrROAN998c4ftm2++mYEDB3LzzTczc+bM2jq3n7eqqooHHniAf//3f+ell15i8ODBTJw4kaqqKoqLi3niiSd2uB5JkhrTaoPGh+3SWGj31p0ZNGgQhx56KD169KBPnz786Ec/YuDAgQ22fR8+fDhnnnkm//3f/81VV13FtGnTuPjii9m6dStlZWV06dKFNWvWAPDKK6/ws5/9jOOPP55zzz2XN998k2XLln2gdvL9+/dn1qxZXHLJJYwaNYp99tmHww47rMHr2GOPPXjjjTd22HfUUUcxceJEVqxYQdeuXenXrx+f+9znKC8vZ8SIEVRXVzN16lQOPPBA9ttvP6ZOncr8+fN56623uPvuu+nSpQsvv9zgMimSJDXINvHNZNGiRSxbtox58+aRUuKggw7iN7/5DT169GjWOupbvnw5d999N9dee+0uncc28R8tTb2Ohm3ipbbNNvGtwJgxY3jxxRcZOnQoRx55JDNmzGjxkAHQuXPn2hkTSZKaWqu9dbK76datG/fdd1+Tn/exxx5jxowZO+wbMmQI11xzTUGvP/zwwzn88MObvC5JksCg0eYNGTKE5cuX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AX1Vk0dBhwTEYNbtiqp1fgLcCfQtaULkVqJXsDVKaURwOnAdS1cT7MwaOyaxlZNlT6yUkrrgbdaug6ptUgpPZ9SeqBm8w2guCXraS4GjV3TF6i7ZshG/N+bJKlxlwPXt3QRzcGgsWsaWjV1dcuUIrVa0dIFSK1FTcfzq4G/pZTuaul6moNBY9c0tmqqJOjY0gVIrUFE9ATuAf5fSunCiPhI/A4upNeJdqKhVVNTSm+3cFlSa7Ie6NHSRUitxMXAQUDXiDiVd3uEfbVlS8rPBbskSWoGEdEBqEopvdPStTQng4YkScrmI3F/SJIktQyDhiRJysagIUmSsjFoSJKkbAwakiQpG4OGJEnKxqAhSZKy+f8juSbWif+y8wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 648x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#绘制条形图\n",
    "width=0.05\n",
    "x = np.arange(3)\n",
    "plt.figure(figsize=(9,6))\n",
    "rects1 = plt.bar(x - 5/2*width, gresult['Fresh'], width) # 返回绘图区域对象\n",
    "rects2 = plt.bar(x - 3/2*width, gresult['Milk'], width)\n",
    "rects3 = plt.bar(x - 1/2*width, gresult['Grocery'], width) # 返回绘图区域对象\n",
    "rects4 = plt.bar(x + 1/2*width, gresult['Frozen'], width)\n",
    "rects5 = plt.bar(x + 3/2*width, gresult['Detergents_Paper'], width) # 返回绘图区域对象\n",
    "rects6 = plt.bar(x + 5/2*width, gresult['Delicassen'], width)\n",
    "\n",
    "plt.legend(['Fresh','Milk','Grocery','Frozen','Detergents_Paper','Delicassen'],loc='upper left')\n",
    "plt.xticks(x,gresult.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "da699d89",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
